/*****************************************************************
*
*	Netcare Agent Project
*		Copyright(C) 2010, Wicresoft EKA. All Rights Reserved.
*
*	Authors:
*		Miles Chen (milesch@wicresoft.com)
*		TingRong Shi (trshi@wicresoft.com)
*
*	Part of the product code depends on gSOAP under GPL license
*		Copyright(C) 2000-2010, Robert van Engelen, Genivia Inc. All Rights Reserved.
*
*****************************************************************/
#include <iostream>
#include <sstream>


#include "ConsoleLogListener.h"
#include "DateTime.h"
#include "misc.h"

ALCATEL_SMS;

USING_STD;

ostream& CConsoleLogListener::_os = cout;
CConsoleLogListener::CConsoleLogListener(void)
{
}


CConsoleLogListener::~CConsoleLogListener(void)
{
}

void CConsoleLogListener::WriteLine(const char* level, const wchar_t* message)
{
	char* p = _UTF8(message);
	WriteLine(level, p);
	delete[] p;
}

void CConsoleLogListener::WriteLine(const char* level, const char* message)
{
	CDateTime* time = CDateTime::Now();
	_buffer << "[" << time->ToString() << "][" << level << "] " << message << endl;
	delete time;

	_os << _buffer.str();
	_buffer.str("");
}

ENDNS ENDNS